#include <bits/stdc++.h>
using namespace std;
int ppower[1005]={1};
int sum[1005]={1};
int getLength(int n[]){
    int length=1004;
    while (!n[length]){
        length--;
    }
    return length;
}
int getLength(int n){
    if (0<=n<10) return 1;
    if (10<=n<100) return 2;
    return 0;
}
void add(int x[],int y[]){
    for (int i=0;i<max(getLength(x),getLength(y))+1;i++){
        x[i]+=y[i];
        if (x[i] >= 10){
            x[i+1]+=x[i]/10;
            x[i]%=10;
        }
    }
}
int mul_res[1005];
void multiply(int x[],int y){
    memset(mul_res,0,sizeof(mul_res));
    for (int i=0;i<getLength(x)+getLength(y)+1;i++){
        mul_res[i]+=x[i]*y;
        if (mul_res[i] >= 10){
            mul_res[i+1]+= mul_res[i]/10;
            mul_res[i]%=10;
        }
    }
    memcpy(x,mul_res,sizeof(mul_res));
}
int main(){
    int n;
    cin>>n;
    for (int i=2;i<=n;i++){
        multiply(ppower,i);
        add(sum,ppower);
    }
    for (int i=getLength(sum);i>=0;i--){
        cout<<sum[i];
    }
    return 0;
}